for (var cess = CC['@mozilla.org/categorymanager;1'].getService(CI.nsICategoryManager)
.enumerateCategory("net-channel-event-sinks");
cess.hasMoreElements();) {
ces = cess.getNext();
if (ces instanceof CES)
ces.onChannelRedirect(oldChan, newChan, flags);
}
ces = IOUtil.queryNotificationCallbacks(oldChan, CES);
if (ces) ces.onChannelRedirect(oldChan, newChan, flags);
// ----------------------------------
newChan.originalURI = oldChan.originalURI;
ces = IOUtil.queryNotificationCallbacks(oldChan, CI.nsIHttpEventSink);
if (ces) ces.onRedirect(oldChan, newChan);
},
replace: function(isRedir) {
this._onChannelRedirect(isRedir);
// dirty trick to grab listenerContext
var oldChan = this.oldChannel;
var ccl = new CtxCapturingListener(oldChan);
oldChan.cancel(NS_BINDING_REDIRECTED); // this works because we've been called after loadGroup->addRequest(), therefore asyncOpen() always return NS_OK
oldChan.notificationCallbacks =
oldChan.loadGroup = null; // prevent loadGroup removal and wheel stop
if (oldChan instanceof CI.nsIRequestObserver) {
oldChan.onStartRequest(oldChan, null);
}
this.listener = ccl.originalListener;
this.context = ccl.originalCtx;
this._ccListener = ccl;
return this;
},
open: function() {
var oldChan = this.oldChannel, newChan = this.channel;
var overlap, fail = false;
if (!(this.window && (overlap = ABERequest.getLoadingChannel(this.window)) !== oldChan)) {